package com.pacy.pacybaseproject.fragments;

import android.graphics.Color;
import android.os.Bundle;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.ViewGroup;


import com.fondesa.recyclerviewdivider.DividerBuilder;
import com.pacy.pacybaseproject.BR;
import com.pacy.pacybaseproject.R;
import com.pacy.pacybaseproject.base.BaseXFragment;
import com.pacy.pacybaseproject.databinding.FragmentIntegralBinding;
import com.pacy.pacybaseproject.viewmodels.IntegralViewModel;
import com.xuexiang.xui.utils.StatusBarUtils;
import com.xuexiang.xui.utils.ViewUtils;

import io.reactivex.annotations.Nullable;
import me.goldze.mvvmhabit.utils.ScreenUtil;

/**
 * @author PACY
 * @date 2023/12/20
 * description: 积分
 */
public class IntegralFragment extends BaseXFragment<FragmentIntegralBinding, IntegralViewModel> {

    public static IntegralFragment newInstance(String title) {

        Bundle args = new Bundle();
        args.putString("title", title);
        IntegralFragment fragment = new IntegralFragment();
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    public int initContentView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        return R.layout.fragment_integral;
    }

    @Override
    public int initVariableId() {
        return BR.viewModel;
    }

    @Override
    public void initData() {
        super.initData();
        ViewUtils.setPaddingTop( binding.jifenTopLin, StatusBarUtils.getStatusBarHeight(getContext())+ ScreenUtil.dp2px(16));
        if (binding.acRecyclerView.getItemDecorationCount() == 0) {
            new DividerBuilder(getContext())
                    .size(1, TypedValue.COMPLEX_UNIT_DIP)
                    .color(Color.parseColor("#F6F4F5"))
//                    .showFirstDivider()
//                    .showLastDivider()
                    .build().addTo(binding.acRecyclerView);
        }

        if (binding.exRecyclerView.getItemDecorationCount() == 0) {
            new DividerBuilder(getContext())
                    .size(10, TypedValue.COMPLEX_UNIT_DIP)
                    .color(Color.TRANSPARENT)
//                    .showFirstDivider()
//                    .showLastDivider()
                    .build().addTo(binding.exRecyclerView);
        }

        if (binding.dxRecyclerView.getItemDecorationCount() == 0) {
            new DividerBuilder(getContext())
                    .size(21, TypedValue.COMPLEX_UNIT_DIP)
                    .color(Color.TRANSPARENT)
//                    .showFirstDivider()
//                    .showLastDivider()
                    .build().addTo(binding.dxRecyclerView);
        }
    }
}
